﻿using MiserBlogHelper;
using System;
using System.Collections.Generic;
namespace MiserBlogData.Entities
{
    //数据操作的抽象类
    public abstract class A_Data
    {
        public virtual int Id { set; get; }
        //public virtual int UserId { set; get; }
        public virtual string Content { set; get; }
        public virtual int State { set; get; }
        public virtual DateTime CDate { set; get; }
        public virtual A_Person User { set; get; }

        /// <summary>
        /// 创建website浏览用户
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="UserName"></param>
        /// <param name="Pwd"></param>
        /// <returns></returns>
        public static T Create<T>() where T : A_Data, new()
        {
            T data = new T();
            data.User = A_Person.CreateWithCookie();
            if (data.User != null)
            {
                return data;
            }
            return null;
        }

        public abstract IList<T> GetList<T>() where T : A_Data;
    }
}